package com.wqtz.chechai.view.activities;

import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Toast;

import com.wqtz.chechai.R;
import com.wqtz.chechai.base.BaseActivity;
import com.wqtz.chechai.bean.AccountBean;
import com.wqtz.chechai.presenter.BasePresent;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * 项目名称： CheChai
 * 创建人 :  Kisum
 * 创建时间: 2017/2/6
 * 指定收款账户
 */
public class SpecificAccountActivity extends BaseActivity {
    @BindView(R.id.iv_back)
    ImageView mIvBack;
    @BindView(R.id.et_account_name)
    EditText mEtAccountName;
    @BindView(R.id.et_account_bank)
    EditText mEtAccountBank;
    @BindView(R.id.et_account_number)
    EditText mEtAccountNumber;
    @BindView(R.id.btn_save)
    Button mBtnSave;
    private AccountBean mAccountBean;

    @Override
    public void init() {
        ButterKnife.bind(this);
        mAccountBean = new AccountBean();
        if (!TextUtils.isEmpty(mEtAccountName.getText().toString().trim()) && !TextUtils.isEmpty(mEtAccountBank.getText().toString().trim()) && !TextUtils.isEmpty(mEtAccountNumber.getText().toString().trim())) {
            mBtnSave.setClickable(true);
            mBtnSave.setBackgroundResource(R.drawable.selector_activity_login_btn);
        } else {
            mBtnSave.setClickable(false);
            mBtnSave.setBackgroundResource(R.drawable.shape_login_btn_default);
        }
    }

    @Override
    public void loadData() {

    }

    @Override
    public int setContentViews() {
        return R.layout.activity_specific_account;
    }

    @Override
    public BasePresent createPresenter() {
        return null;
    }

    @OnClick({R.id.iv_back, R.id.btn_save})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                this.finish();
                break;
            //保存收款账户信息
            case R.id.btn_save:
                mAccountBean.setAccountName(mEtAccountName.getText().toString().trim());
                mAccountBean.setAccountName(mEtAccountBank.getText().toString().trim());
                mAccountBean.setAccountName(mEtAccountNumber.getText().toString().trim());
                Toast.makeText(this,"保存成功",Toast.LENGTH_SHORT).show();
                break;
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        activitys.add(this); //添加当前的activity
    }


}
